home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / grafik / 3d & render tools / irit / contrib / compgrap / transforms / 3ddemo.irt < prev    next >
Encoding:
Text File  |  1996-07-16  |  2.9 KB  |  118 lines

  1. #
  2. # Demos for 3D Transformations.
  3. #
  4. #                    (c) Gershon Elber, July 1995
  5. #
  6.  
  7. comment $
  8. pause = procedure():
  9.     printf("Press return to continue:", nil());
  10. $
  11.  
  12. AnimObj = load("solid8") * sc( 0.7 );
  13. color( AnimObj, green );
  14. attrib( AnimObj, "dwidth", 3 );
  15.  
  16. color( Axes, yellow );
  17. attrib( Axes, "dwidth", 4 );
  18.  
  19. #
  20. # 3D transformation's demo.
  21. #
  22. AnimDemo = list( Axes, AnimObj );
  23. interact( AnimDemo );
  24.  
  25.  
  26. # SCALING uniformly.
  27. #
  28. scl = cbspline( 3,
  29.             list( ctlpt( E1, 1 ),
  30.               ctlpt( E1, 3 ),
  31.               ctlpt( E1, 0 ),
  32.               ctlpt( E1, 0 ),
  33.               ctlpt( E1, 1 ) ),
  34.             list( KV_OPEN ) );
  35. scl = creparam( scl, 0, 1 );
  36. attrib( AnimDemo, "animation", list( scl ) );
  37. interact( list( AnimDemo ) );
  38.  
  39. #
  40. # SCALING in X, Y, and Z operations.
  41. #
  42. scl = cbspline( 3,
  43.         list( ctlpt( E1, 1 ),
  44.               ctlpt( E1, 3 ),
  45.               ctlpt( E1, 0 ),
  46.               ctlpt( E1, 0 ),
  47.               ctlpt( E1, 1 ) ),
  48.         list( KV_OPEN ) );
  49. scl_x = creparam( scl, 0, 0.33 );
  50. scl_y = creparam( scl, 0.33, 0.67 );
  51. scl_z = creparam( scl, 0.67, 1 );
  52. attrib( AnimDemo, "animation", list( scl_x, scl_y, scl_z ) );
  53. interact( list( AnimDemo ) );
  54.  
  55. #
  56. # SCALING with NEGATIVE values.
  57. #
  58. scl = cbspline( 2,
  59.                 list( ctlpt( E1, 1 ),
  60.                       ctlpt( E1, -1 ) ),
  61.                 list( KV_OPEN ) );
  62. scl_x = creparam( scl, 0, 0.33 );
  63. scl_y = creparam( scl, 0.33, 0.67 );
  64. scl_z = creparam( scl, 0.67, 1 );
  65. attrib( AnimDemo, "animation", list( scl_x, scl_y, scl_z ) );
  66. interact( list( AnimDemo ) );
  67.  
  68. #
  69. # ROTATIONs
  70. #
  71. rot = cbspline( 2,
  72.                 list( ctlpt( E1, 0 ),
  73.                       ctlpt( E1, 360 ) ),
  74.                 list( KV_OPEN ) );
  75. rot_x = creparam( rot, 0, 0.33 );
  76. rot_y = creparam( rot, 0.33, 0.67 );
  77. rot_z = creparam( rot, 0.67, 1 );
  78. attrib( AnimDemo, "animation", list( rot_x, rot_y, rot_z ) );
  79. interact( list( Axes, AnimDemo ) );
  80.  
  81. #
  82. # TRANSLATION in the plane.
  83. #
  84. mov = cbspline( 3,
  85.                 list( ctlpt( E1,  0.0 ),
  86.                       ctlpt( E1,  0.7 ),
  87.                       ctlpt( E1,  0.7 ),
  88.                       ctlpt( E1, -0.7 ),
  89.                       ctlpt( E1, -0.7 ),
  90.                       ctlpt( E1,  0.0 ) ),
  91.                 list( KV_OPEN ) );
  92. mov_x = creparam( mov, 0, 0.33 );
  93. mov_y = creparam( mov, 0.33, 0.67 );
  94. mov_z = creparam( mov, 0.67, 1 );
  95. attrib( AnimDemo, "animation", list( mov_x, mov_y, mov_z ) );
  96. interact( list( AnimDemo ) );
  97.  
  98. #
  99. # PROJECTION onto XY plane.
  100. #
  101. rot_x = ctlpt( E1, 0.0 ) + ctlpt( E1, 360 );
  102. rot_y = ctlpt( E1, 0.0 ) + ctlpt( E1, 180 );
  103. rot_z = ctlpt( E1, 0.0 ) + ctlpt( E1, 720 );
  104. mov_z = cbspline( 3,
  105.                   list( ctlpt( E1,  1.2 ),
  106.                         ctlpt( E1,  2.0 ),
  107.                         ctlpt( E1,  1.2 ) ),
  108.                   list( KV_OPEN ) );
  109. proj = sz( 0.001 );
  110.  
  111. Obj = AnimObj;
  112. ObjProj = AnimObj;
  113.  
  114. attrib( Obj, "animation", list( rot_x, rot_z, rot_y, mov_z ) );
  115. attrib( ObjProj, "animation", list( rot_x, rot_z, rot_y, proj ) );
  116. rmattr( Axes, "animation" );
  117. interact( list( Axes, Obj, ObjProj ) );
  118.